<?php

namespace App\Http\Requests\Api;

class ResumeDataRequest extends ApiRequest
{
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'id' => 'bail|required|integer',
            'name' => 'required',
            'sex' => 'bail|required|integer|between:0,2',
            'birthday' => 'bail|required|before:now',
            'education' => 'bail|required|integer',
            'work_year' => 'bail|required|integer',
            'homeaddress' => 'integer',
            'job_status' => 'bail|required|integer|between:1,4',
            'longitude' => 'numeric',
            'latitude' => 'numeric',
            'census' => 'integer',
            'marital' => 'integer',
            'height' => 'integer',
            'jobsort' => '',
            'jobarea' => '',
            'intentionjobs' => '',
            'email' => 'email',
        ];
    }

    public function attributes()
    {
        return [
            'name' => '姓名',
            'sex' => '性别',
            'birthday' => '生日',
            'education' => '学历',
            'work_year' => '相关工作经验',
            'homeaddress' => '现住址',
            'job_status' => '求职状态',
            'census' => '户籍',
            'marital' => '婚姻状况',
            'height' => '身高',
            'longitude' => '经度',
            'latitude' => '纬度',
        ];
    }

    public function messages()
    {
        return array_merge(parent::messages(), [
            'birthday.before' => ':attribute不能小于现在',
        ]);
    }
}
